<script setup lang="ts">
import { getLanguage, setLanguage, useLang } from 'i18n-use'
import { ref } from 'vue'

import fire from '@/assets/fire.png'

const count = ref(false)
const { t } = useLang('home')
const changeLang = () => {
  setLanguage(getLanguage() == 'zh' ? 'in' : 'zh')
  count.value = !count.value
}
</script>

<template>
  <div>
    <h3>home 首页</h3>
    <router-link to="test">跳转到 test</router-link>
    <ul>
      <li>翻译内容：{{ t('姓名') }}</li>
      <li>
        动态翻译内容：{{
          t('年龄{age}', {
            age: 18,
          })
        }}
      </li>
    </ul>
    <p :style="{ color: count ? 'red' : '#000' }" @click="changeLang">
      切换语言{{ getLanguage() }}
    </p>
    <img class="fire" :src="fire" alt="" />
  </div>
</template>

<style scoped>
.fire {
  width: 400px;
  height: 400px;
}
</style>
